Previous Book Contents Book Index Next

Inside Macintosh: Open Transport /
Chapter 3 - Endpoints / Endpoints Reference
Functions / Tearing Down a Connection


OTSndDisconnect

Tears down an open connection (abortive disconnect) or rejects an incoming connection request.

C INTERFACE
OSStatus OTSndDisconnect(EndpointRef ref, TCall* call);
C++ INTERFACE
OSStatus TEndpoint::SndDisconnect(TCall* call);
PARAMETERS
ref
The endpoint reference for the endpoint tearing down the connection or rejecting the connection request.
call
A pointer to a TCall structure (page 3-62) that specifies the connection to be torn down or rejected and specifies data sent with the disconnection request if the endpoint supports sending such data.
DESCRIPTION
There are two functions that you can use to tear down a connection: OTSndDisconnect for an abortive disconnect, or OTSndOrderlyDisconnect for an orderly disconnect. It is recommended that you use the OTSndOrderlyDisconnect function for tearing down a connection whenever possible and that you use the OTSndDisconnect function only for rejecting incoming connection requests.

If the endpoint is in asynchronous mode, the OTSndDisconnect function returns immediately with a result of kOTNoError to indicate that the disconnection process has begun and that your notifier function will be called when the process completes.

When the connection has been broken, the provider issues a T_DISCONNECTCOMPLETE event. If you have installed a notifier function, Open Transport calls your notifier and passes this event in the code parameter. The cookie parameter contains the call parameter. If you have not installed a notifier function, you cannot determine when this function completes.

COMPLETION EVENT CODES
T_DISCONNECTCOMPLETE0x20000005The OTSndDisconnect function has completed. The cookie parameter contains the call parameter.
VALID STATES
T_DATAXFER, T_OUTCON, T_OUTREL, T_INREL (and T_INCON, when two or more incoming connection requests are outstanding)

SEE ALSO
To acknowledge an abortive disconnect, you call the OTRcvDisconnect function (described next).

You use the TCall structure (page 3-62) to describe the connection being torn down or rejected.

You use the OTListen function (page 3-125) to listen for a disconnection request.

You can examine the discon field of the TEndpointInfo structure (page 3-48) for the endpoint to determine whether the endpoint supports sending data during the disconnection and to find out the maximum size of such data.

For information on how to use this function with a TCP/IP protocol, see page 8-19 in the TCP/IP chapter.

For information on how to use this function with AppleTalk protocols, see page 13-12 in the ADSP chapter and page 15-11 in the PAP chapter.

For information on abortive and orderly disconnects, see "Terminating a Connection," beginning on page 3-30.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 AUG 1996